/*jslint sloppy: true */
/*global require */
var LM = require('../global');
require('./create.html');

LM.controller('CreateCase', function ($scope, $routeParams, Case, $location) {
	var $case, projectId = $routeParams.projectId;
	$case = $scope['case'] = new Case({code: "#TIMES 1\n#INTERVAL 3000\n\nprocess main {\n}"});
	$scope.createCase = function () {
		$case.$create({ projectId: projectId }, function () {
			$location.url('/project/' + projectId + '/case/' + $case.caseId);
		});
	};

	//init
	$scope.queryConfig.clear().setActive();
	$scope.navConfig.setHref('#/project/' + projectId + '/case').setType('back');
});
